/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DatosEcoestressPanel.java
 *
 * Created on 17/01/2011, 17:20:58
 */

package presentacion.examen;

import hibernate.objeto.EcoestressEstudioCardiologia;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JDialog;
import javax.swing.JSpinner.DefaultEditor;
import logica.CapaLogica;
import logica.validacion.CapaValidacion;
import presentacion.CapaPresentacion;
import presentacion.utilidad.maquetado.Fuente;
import presentacion.utilidad.maquetado.InformeError;

/**
 *
 * @author Gonzalo
 */
public class DatosEcoestressPanel extends javax.swing.JPanel {

    /** Creates new form DatosEcoestressPanel */
    public DatosEcoestressPanel() {
        initComponents();
        setearEventosQueCapturanTeclaEnterYEscape();
    }

    /**
     * Setea datos de la ventana.
     *
     */
    public void personalizarJDialog(EcoestressEstudioCardiologia
            ecoestressEstudioCardiologia) {
        this.ecoestressEstudioCardiologia = ecoestressEstudioCardiologia;
            exhibirDatosEnPantalla();
            if(CapaPresentacion.modoVisualizacion) {
                inhabilitarCampos();
            }
    }

    /**
     * Permite visualizar los detalles de la evolución.
     *
     */
    private void exhibirDatosEnPantalla() {
        apremioEcoestress.getModel().setSelectedItem(
                ecoestressEstudioCardiologia.
                getApremioEcoestressEstudioCardiologia());
        fCBasalEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getFcBasalEcoestressEstudioCardiologia());
        tensionArterialBasalDiastolicaEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getTensionArterialBasalDiastolicaEcoestressEstudioCardiologi());
        tensionArterialBasalSistolicaEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getTensionArterialBasalSistolicaEcoestressEstudioCardiologia());
        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getTensionArterialMaximoEsfuerzoDiastolicaEcoestressEstudio());
        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getTensionArterialMaximoEsfuerzoSistolicaEcoestressEstudioC());
        segmentoSTEcoestress.setValue(
                ecoestressEstudioCardiologia.
                getSegmentoStEcoestressEstudioCardiologia());
        if (ecoestressEstudioCardiologia.
                getAngorEcoestressEstudioCardiologia().
                equalsIgnoreCase("si")) {
            siAngorEcoestress.setSelected(true);
            noAngorEcoestress.setSelected(false);
        } else {
            siAngorEcoestress.setSelected(false);
            noAngorEcoestress.setSelected(true);
        }
        ecoBasalEcoestress.setText(
                ecoestressEstudioCardiologia.
                getEcoBasalEcoestressEstudioCardiologia());
        ecoBasalEcoestress.setCaretPosition(0);
        ecoMaximaCargaEcoestress.setText(
                ecoestressEstudioCardiologia.
                getEcoMaximaCargaEcoestressEstudioCardiologia());
        ecoMaximaCargaEcoestress.setCaretPosition(0);
        conclusionesEcoestress.setText(
                ecoestressEstudioCardiologia.
                getConclusionesEcoestressEstudioCardiologia());
        conclusionesEcoestress.setCaretPosition(0);

    }

    /**
     * Pone en false la propiedad enabled de todos los campos de ingreso.
     *
     */
    private void inhabilitarCampos() {
        apremioEcoestress.setEnabled(false);
        fCBasalEcoestress.setEnabled(false);
        tensionArterialBasalDiastolicaEcoestress.setEnabled(false);
        tensionArterialBasalSistolicaEcoestress.setEnabled(false);
        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setEnabled(false);
        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setEnabled(false);
        segmentoSTEcoestress.setEnabled(false);
        siAngorEcoestress.setEnabled(false);
        noAngorEcoestress.setEnabled(false);
        ecoBasalEcoestress.setEnabled(false);
        ecoMaximaCargaEcoestress.setEnabled(false);
        conclusionesEcoestress.setEnabled(false);
    }

    /**
     * Valida en conjunto todos los campos. Aquellos que son obligatorios y los
     * que no.
     *
     * @return true si el objeto está listo para cargarse, false en caso
     * contrario
     */
    public boolean validarCampos() {
        boolean esApremioValida = validarCampoApremio();
        boolean esAngorValida = validarCamposAngor();
        boolean esEcoBasalValida = validarCampoEcoBasal();
        boolean esEcoMaximaCargaValida = validarCampoEcoMaximaCarga();

        return esApremioValida && esAngorValida &&
                esEcoBasalValida && esEcoMaximaCargaValida;
    }

    /**
     * Valida los campos correspondiente al campo Apremio.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCampoApremio() {
        boolean retorno;

        if (!CapaValidacion.validarCampoObligatorio(apremioEcoestress.
                getSelectedItem().toString())) {
            textoApremioEcoestress.setForeground(
                    Fuente.COLOR_ERROR);
            textoApremioEcoestress.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_ECOESTRESS_APREMIO);
            retorno = false;
        } else {
            textoApremioEcoestress.setForeground(Fuente.COLOR_NORMAL);
            textoApremioEcoestress.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Valida los campos correspondiente al campo Angor.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCamposAngor() {
        boolean retorno;

        if (!siAngorEcoestress.isSelected() &&
                !noAngorEcoestress.isSelected()) {
            textoAngorEcoestress.setForeground(
                    Fuente.COLOR_ERROR);
            textoAngorEcoestress.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_ECOESTRESS_ANGOR);
            retorno = false;
        } else {
            textoAngorEcoestress.setForeground(Fuente.COLOR_NORMAL);
            textoAngorEcoestress.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Valida los campos correspondiente al campo Eco Basal.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCampoEcoBasal() {
        boolean retorno;

        if (!CapaValidacion.validarCampoObligatorio(ecoBasalEcoestress.
                getText())) {
            textoEcoBasalEcoestress.setForeground(
                    Fuente.COLOR_ERROR);
            textoEcoBasalEcoestress.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_ECOESTRESS_ECO_BASAL);
            retorno = false;
        } else {
            textoEcoBasalEcoestress.setForeground(Fuente.COLOR_NORMAL);
            textoEcoBasalEcoestress.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Valida los campos correspondiente al campo Eco Máxima Carga.
     *
     * @return true si los campos estan listos para cargarse, false en caso
     * contrario
     */
    private boolean validarCampoEcoMaximaCarga() {
        boolean retorno;

        if (!CapaValidacion.validarCampoObligatorio(ecoMaximaCargaEcoestress.
                getText())) {
            textoEcoMaximaCargaEcoestress.setForeground(
                    Fuente.COLOR_ERROR);
            textoEcoMaximaCargaEcoestress.setToolTipText(
                    InformeError.
                    INFORME_ERROR_CARDIOLOGICO_ECOESTRESS_ECO_MAXIMA_CARGA);
            retorno = false;
        } else {
            textoEcoMaximaCargaEcoestress.setForeground(Fuente.COLOR_NORMAL);
            textoEcoMaximaCargaEcoestress.setToolTipText(null);
            retorno = true;
        }

        return retorno;
    }

    /**
     * Recopila los datos del panel para colocarlos dentro del arreglo.
     *
     * @param datosEstudioCardiologia El arreglo a cargar
     */
    public void recopilarDatos(Object[] datosEstudioCardiologia) {

        if (siAngorEcoestress.isSelected()) {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_ANGOR] =
                "si";
        } else {
            datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_ANGOR] =
                "no";
        }
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_ECOESTRESS_APREMIO] =
                apremioEcoestress.getSelectedItem();
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_ECOESTRESS_CONCLUSIONES] =
                conclusionesEcoestress.getText();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_ECO_BASAL] =
                ecoBasalEcoestress.getText();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_ECO_MAXIMA_CARGA] =
                ecoMaximaCargaEcoestress.getText();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_FC_BASAL] =
                fCBasalEcoestress.getValue();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_SEGMENTO_ST] =
                segmentoSTEcoestress.getValue();
        datosEstudioCardiologia[CapaLogica.ESTUDIO_CARDIOLOGIA_ECOESTRESS_TENSION_ARTERIAL_BASAL_DIASTOLICA] =
                tensionArterialBasalDiastolicaEcoestress.getValue();
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_ECOESTRESS_TENSION_ARTERIAL_BASAL_SISTOLICA] =
                tensionArterialBasalSistolicaEcoestress.getValue();
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_ECOESTRESS_TENSION_ARTERIAL_MAXIMO_ESFUERZO_DIASTOLICA] =
                tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.getValue();
        datosEstudioCardiologia[CapaLogica.
                ESTUDIO_CARDIOLOGIA_ECOESTRESS_TENSION_ARTERIAL_MAXIMO_ESFUERZO_SISTOLICA] =
                tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.getValue();

    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        textoApremioEcoestress = new javax.swing.JLabel();
        textoEcoBasalEcoestress = new javax.swing.JLabel();
        fCBasalEcoestress = new javax.swing.JSpinner();
        ecoMaximaCargaEcoestress = new javax.swing.JTextField();
        conclusionesEcoestressScrollPane = new javax.swing.JScrollPane();
        conclusionesEcoestress = new javax.swing.JTextArea();
        textoEcoMaximaCargaEcoestress = new javax.swing.JLabel();
        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress = new javax.swing.JSpinner();
        textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress = new javax.swing.JLabel();
        textoTensionArterialBasalDiastolicaEcoestress = new javax.swing.JLabel();
        ecoBasalEcoestress = new javax.swing.JTextField();
        textoFCBasalEcoestress = new javax.swing.JLabel();
        tensionArterialBasalDiastolicaEcoestress = new javax.swing.JSpinner();
        textoTensionArterialBasalSistolicaEcoestress = new javax.swing.JLabel();
        textoAngorEcoestress = new javax.swing.JLabel();
        tensionArterialBasalSistolicaEcoestress = new javax.swing.JSpinner();
        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress = new javax.swing.JSpinner();
        textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress = new javax.swing.JLabel();
        textoSegmentoSTEcoestress = new javax.swing.JLabel();
        textoConclusionesEcoestress = new javax.swing.JLabel();
        segmentoSTEcoestress = new javax.swing.JSpinner();
        siAngorEcoestress = new javax.swing.JRadioButton();
        noAngorEcoestress = new javax.swing.JRadioButton();
        apremioEcoestress = new javax.swing.JComboBox();

        setPreferredSize(new java.awt.Dimension(42, 20));

        textoApremioEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoApremioEcoestress.setText("Apremio");
        textoApremioEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        textoEcoBasalEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoEcoBasalEcoestress.setText("Eco basal");
        textoEcoBasalEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        fCBasalEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        fCBasalEcoestress.setModel(new javax.swing.SpinnerNumberModel());
        fCBasalEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        ecoMaximaCargaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        ecoMaximaCargaEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        conclusionesEcoestressScrollPane.setPreferredSize(new java.awt.Dimension(242, 80));

        conclusionesEcoestress.setColumns(20);
        conclusionesEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        conclusionesEcoestress.setRows(4);
        conclusionesEcoestressScrollPane.setViewportView(conclusionesEcoestress);

        textoEcoMaximaCargaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoEcoMaximaCargaEcoestress.setText("Eco máxima carga");
        textoEcoMaximaCargaEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setModel(new javax.swing.SpinnerNumberModel());
        tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setText("Tensión arterial máximo esfuerzo basal sistólica");
        textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        textoTensionArterialBasalDiastolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoTensionArterialBasalDiastolicaEcoestress.setText("Tensión arterial basal diastólica");
        textoTensionArterialBasalDiastolicaEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        ecoBasalEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        ecoBasalEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        textoFCBasalEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoFCBasalEcoestress.setText("FC basal");
        textoFCBasalEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        tensionArterialBasalDiastolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        tensionArterialBasalDiastolicaEcoestress.setModel(new javax.swing.SpinnerNumberModel());
        tensionArterialBasalDiastolicaEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        textoTensionArterialBasalSistolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoTensionArterialBasalSistolicaEcoestress.setText("Tensión arterial basal sistólica");
        textoTensionArterialBasalSistolicaEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        textoAngorEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoAngorEcoestress.setText("Angor");
        textoAngorEcoestress.setMinimumSize(new java.awt.Dimension(225, 20));
        textoAngorEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        tensionArterialBasalSistolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        tensionArterialBasalSistolicaEcoestress.setModel(new javax.swing.SpinnerNumberModel());
        tensionArterialBasalSistolicaEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setModel(new javax.swing.SpinnerNumberModel());
        tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setText("Tensión arterial máximo esfuerzo basal diastólica");
        textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        textoSegmentoSTEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoSegmentoSTEcoestress.setText("Segmento ST (mm)");
        textoSegmentoSTEcoestress.setPreferredSize(new java.awt.Dimension(233, 20));

        textoConclusionesEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        textoConclusionesEcoestress.setText("Conclusiones");
        textoConclusionesEcoestress.setPreferredSize(new java.awt.Dimension(102, 20));

        segmentoSTEcoestress.setFont(Fuente.FUENTE_TEXTFIELD);
        segmentoSTEcoestress.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f)));
        segmentoSTEcoestress.setPreferredSize(new java.awt.Dimension(70, 20));

        siAngorEcoestress.setFont(Fuente.FUENTE_CHECKBOX
        );
        siAngorEcoestress.setForeground(Fuente.COLOR_NORMAL);
        siAngorEcoestress.setText("si");
        siAngorEcoestress.setPreferredSize(new java.awt.Dimension(42, 20));
        siAngorEcoestress.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                siAngorEcoestressActionPerformed(evt);
            }
        });

        noAngorEcoestress.setFont(Fuente.FUENTE_CHECKBOX
        );
        noAngorEcoestress.setForeground(Fuente.COLOR_NORMAL);
        noAngorEcoestress.setText("no");
        noAngorEcoestress.setPreferredSize(new java.awt.Dimension(42, 20));
        noAngorEcoestress.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                noAngorEcoestressActionPerformed(evt);
            }
        });

        apremioEcoestress.setFont(Fuente.FUENTE_COMBOBOX);
        apremioEcoestress.setModel(CapaPresentacion.getListaDeTipoApremioEcoestressEstudioCardiologia());
        apremioEcoestress.setNextFocusableComponent(conclusionesEcoestress);
        apremioEcoestress.setPreferredSize(new java.awt.Dimension(111, 20));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(textoFCBasalEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoEcoMaximaCargaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoEcoBasalEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoSegmentoSTEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoTensionArterialBasalDiastolicaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoTensionArterialBasalSistolicaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(textoAngorEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(textoConclusionesEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(textoApremioEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(segmentoSTEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ecoBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(siAngorEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(noAngorEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(tensionArterialBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(apremioEcoestress, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                        .addComponent(ecoMaximaCargaEcoestress, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(49, 49, 49))
            .addGroup(layout.createSequentialGroup()
                .addGap(120, 120, 120)
                .addComponent(conclusionesEcoestressScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoFCBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fCBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoTensionArterialBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoTensionArterialBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoAngorEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(siAngorEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(noAngorEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoSegmentoSTEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(segmentoSTEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoEcoBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ecoBasalEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ecoMaximaCargaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(textoEcoMaximaCargaEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoApremioEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(apremioEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textoConclusionesEcoestress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(conclusionesEcoestressScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void siAngorEcoestressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_siAngorEcoestressActionPerformed
        if (siAngorEcoestress.isSelected()) {
            noAngorEcoestress.setSelected(false);
        }
}//GEN-LAST:event_siAngorEcoestressActionPerformed

    private void noAngorEcoestressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noAngorEcoestressActionPerformed
        if (noAngorEcoestress.isSelected()) {
            siAngorEcoestress.setSelected(false);
        }
}//GEN-LAST:event_noAngorEcoestressActionPerformed

    /**
     * Setea en cada componente del JDialog los eventos que capturarán la tecla
     * enter y escape.
     */
    private void setearEventosQueCapturanTeclaEnterYEscape() {
        //Declaración del evento a capturar
        KeyListener keyListenerEscape = new KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
                    cerrarVentana();
                }
            }
        };

        //Setear eventos
        ((DefaultEditor) fCBasalEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) tensionArterialBasalDiastolicaEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) tensionArterialBasalSistolicaEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ((DefaultEditor) tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        siAngorEcoestress.addKeyListener(keyListenerEscape);
        noAngorEcoestress.addKeyListener(keyListenerEscape);
        ((DefaultEditor) segmentoSTEcoestress.getEditor()).
                getTextField().addKeyListener(keyListenerEscape);
        ecoBasalEcoestress.addKeyListener(keyListenerEscape);
        ecoMaximaCargaEcoestress.addKeyListener(keyListenerEscape);
        apremioEcoestress.addKeyListener(keyListenerEscape);
        conclusionesEcoestress.addKeyListener(keyListenerEscape);
    }

    private void cerrarVentana() {
        JDialog jdialog = (JDialog)
                this.getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().
                getParent().getParent().getParent().getParent().getParent();
        jdialog.dispose();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox apremioEcoestress;
    private javax.swing.JTextArea conclusionesEcoestress;
    private javax.swing.JScrollPane conclusionesEcoestressScrollPane;
    private javax.swing.JTextField ecoBasalEcoestress;
    private javax.swing.JTextField ecoMaximaCargaEcoestress;
    private javax.swing.JSpinner fCBasalEcoestress;
    private javax.swing.JRadioButton noAngorEcoestress;
    private javax.swing.JSpinner segmentoSTEcoestress;
    private javax.swing.JRadioButton siAngorEcoestress;
    private javax.swing.JSpinner tensionArterialBasalDiastolicaEcoestress;
    private javax.swing.JSpinner tensionArterialBasalSistolicaEcoestress;
    private javax.swing.JSpinner tensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress;
    private javax.swing.JSpinner tensionArterialMaximoEsfuerzoBasalSistolicaEcoestress;
    private javax.swing.JLabel textoAngorEcoestress;
    private javax.swing.JLabel textoApremioEcoestress;
    private javax.swing.JLabel textoConclusionesEcoestress;
    private javax.swing.JLabel textoEcoBasalEcoestress;
    private javax.swing.JLabel textoEcoMaximaCargaEcoestress;
    private javax.swing.JLabel textoFCBasalEcoestress;
    private javax.swing.JLabel textoSegmentoSTEcoestress;
    private javax.swing.JLabel textoTensionArterialBasalDiastolicaEcoestress;
    private javax.swing.JLabel textoTensionArterialBasalSistolicaEcoestress;
    private javax.swing.JLabel textoTensionArterialMaximoEsfuerzoBasalDiastolicaEcoestress;
    private javax.swing.JLabel textoTensionArterialMaximoEsfuerzoBasalSistolicaEcoestress;
    // End of variables declaration//GEN-END:variables
    private EcoestressEstudioCardiologia ecoestressEstudioCardiologia;
}
